//
//  AppUtils.h
//  InTube
//
//  Created by seven on 2019/10/29.
//  Copyright © 2019 seven. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ITAppStartManager.h"
#import "ITTrackManager.h"

#define API_BASE  [AppUtils returnBaseUrl]
#define API_Account_BASE [AppUtils returnAccountBaseUrl]
#define ShareH5BaseURL [AppUtils returnShareH5BaseUrl]
#define AppH5BaseURL [AppUtils returnAppH5BaseUrl]

#define LocalTitle(k) [AppUtils titleForKey:k]

#define MBProgressGIFTAG 1104 //加载带gif的控件tag

NS_ASSUME_NONNULL_BEGIN

@interface AppUtils : NSObject
/**
 返回当前app版本号

 @return app版本号
 */
+ (NSString*)appVersion;
/**域名*/
+(NSString *)returnBaseUrl;

/**返回分享页基地址*/
+(NSString *)returnShareH5BaseUrl;

/** 返回app内网页基地址*/
+(NSString *)returnAppH5BaseUrl;

+ (UIStatusBarStyle)getDarkStyle;
+ (UIStatusBarStyle)getLightStyle;

+ (UINavigationController *)findRootController;
+ (ITTabBarController *)findTabbarController;

+ (UIViewController*)findCurrentViewController;

+ (BOOL)DICT_WORK_MODE;
+ (BOOL)DICT_AU_MODE;

+ (BOOL)isFirshLauch;

+ (NSString *)titleForKey:(NSString *)key, ...;

+(NSString *)getMMSSFromSS:(int)totalTime;

+ (void)showInfo:(NSString *)text;
/**positon  CSToastPositionTop Center Bottom or CGPoint*/
+ (void)showInfo:(NSString *)text position:(id)position;

+ (void)showInfo:(NSString *)text duration:(CGFloat)duration;

+ (void)drawDashLine:(UIView *)lineView lineLength:(int)lineLength lineSpacing:(int)lineSpacing lineColor:(UIColor *)lineColor;

/**
 过滤出符合条件的数组元素

 @param list 原生数组
 @param fieldName 元素的属性名
 @param value 属性对应的值
 @return 返回符合条件的数组元素
 */
+(NSArray *)fiterArray:(NSArray *)list fieldName:(NSString *)fieldName value:(id)value;

+ (void)trackMTAEventNo:(NSString *)eventNo;
+ (void)trackMTAEventNo:(NSString *)eventNo parameters:(NSDictionary * IT_NULLABLE )parameters;

+ (BOOL)isNullStr:(NSString *)str;

+ (MBProgressHUD *)showLoading;
+ (void)hideLoading;


+ (void)pushController:(UIViewController *)uc;
+ (void)pushMemberCenter:(ITMember *)member;

+ (void)pushWebView:(NSString *)url title:(NSString *)title;

+ (NSString *)configDicWithKey:(NSString *)key;


+(void)gradientColorWithView:(UIView *)bgView startPoint:(CGPoint)startPoint toPoint:(CGPoint)toPoint fromColor:(UIColor *)fromColor toColor:(UIColor *)toColor locations:(NSArray *)locations;

+(UIImage *)getGradientImageWithColors:(NSArray*)colors imgSize:(CGSize)imgSize start:(CGPoint)start endPoint:(CGPoint)end;

+(void)setCustomCorners:(UIView *)view roundingCorners:(UIRectCorner)corners cornerRadius:(CGFloat)radius;

+ (BOOL)isNetworkURL:(NSString *)url;

+(NSString *)formatLoadUrl:(NSString *)url;
+ (id)objectWithJsonString:(NSString *)jsonString;
+(NSString *)getYYMMDDFromDate:(NSDate *)date;
@end

NS_ASSUME_NONNULL_END
